import time
from locust import HttpUser, task, between

class QuickstartUser(HttpUser):
    wait_time = between(1, 2)

    @task
    def merchant(self):
        urlpath = '/seller/merchant'
        with self.client.get("http://ec-backup.casstime.com" + urlpath,
                              name=urlpath, timeout=5, catch_response=True) as response:
            if (response.status_code == 200) and ('会员登录' not in response.text):
                response.success()
                print(response.status_code, '查询成功！')
            else:
                response.failure('FailedCode:'+str(response.status_code))
                print(response.text)
                print(response.status_code, '查询失败！')
        print("我是供应商卖家首页1")

    def on_start(self):
        self.client.post("http://ec-backup.casstime.com/passport/login",
                         json={"username":"bsmjg", "password":"123456", "logintype":"PASSWORD"})